Fix Googlebot Cannot Access Css And Js Files Warning In WordPress

How To Fix Googlebot cannot access CSS and JS files Warning In WordPress

Are you getting an error showing that your website is blocking Googlebot to access the CSS and the JS files?

By default, WordPress doesn’t block any of the design files. But some website owners add an extra code to improve the security which may block Googlebot.

In this tutorial, you will learn how to fix Googlebot cannot access CSS and JS files warning in WordPress. Such type of errors can influence the SEO ranking of your website.

Google tries to rank the websites which are user-friendly and easy to access. If any of the design files are blocking Googlebot, it can be a negative point.

Search For the Blocked Files from Your Google Search Console.

First of all, you should add your WordPress website to Google Search Console to analyze it. I hope you have already done that.

Now log in to your account and open the GSC dashboard.

Navigate to Crawl>>Fetch as Google and a page will appear. You don’t need to add anything extra. It’s because you’re analyzing the home page of your website.

Click on the “Fetch and Render” button and within a few seconds, it will get completed.

You will see all the paths you have fetched before.

To see those blocked pages, go to Google Index>>Blocked Resources and a graph will appear to you.

It will show the number of pages which block the Googlebot to scan your website.

To know those particular files, you can click on the URL of your website and it will show all the files.

Fix Googlebot cannot access CSS and JS Files Warning In WordPress Using the robots.txt file.

You should know that a robots.txt file handles the crawling of your website. It guides the Googlebot to crawl your website.

There are many sensitive files and folders which shouldn’t be crawled and indexed in the search engine.

The normal robots.txt file looks like this.

User-agent: *

Disallow: /wp-admin/

Disallow: /wp-includes/

Disallow: /wp-content/plugins/

Disallow: /wp-content/themes/

Many website owners copy and paste some extra code in this file which can block the Googlebot.

Sometimes, any of your plugins or themes is responsible for blocking the access. As mentioned above, you can easily find the path of that file.

Suppose the file is present in the wp-includes folder. To allow access, you have to add that file in the robots.txt file.

You can edit this file from the cPanel.

Go to cPanel>>files>>file manager>>robots.txt file. It’s just a text file and you can find it in the root directory of your website.

If you have moved your website or using any subdomain then search that folder.

To fix Googlebot cannot access CSS and JS files warning in WordPress, you have to allow the files.

Allow: /wp-includes/js/

Add such type of code in your robots.txt file. Don’t forget to replace the file path. It may be present somewhere else.

Another way to Edit robots.txt File.

If you’re afraid of the cPanel and using the Yoast SEO plugin then you can edit this file from your WordPress admin panel only.

Just navigate to SEO>>Tools>>File Editor and the robots.txt file will open.

Use the same type of code mentioned above. Choose the path of the file carefully. Don’t mistakenly allow the folders to get indexed which shouldn’t.

The code shown above means that you have allowed Googlebot to access only “js” file present inside the wp-includes folder.

You are still blocking access to the wp-includes folder.

After that go again to the crawling section and use the fetch and render button again. Check the number of pages blocked from the Google index.

If you don’t get any, congrats. You have successfully solved the problem. I hope now you can fix Googlebot cannot access CSS and JS files warning in WordPress. If you have any doubt, feel free to drop a comment.

You can also connect with us on Twitter, LinkedIn, and Facebook.

by Ravi Chahar

A WordPress Professional and the LinkedIn Influencer. A coder by passion and a blogger by choice. WordPress theme development is his forte. He is your WordPress guy who will teach you how to solve WordPress errors, WordPress security issues, design issues and what not.


Get Free Updates Into Your Inbox

Learn Everything Just Like I Did

SUBSCRIBE



5 comments

  1. In one of my website, all the articles are getting indexed, but I am facing issue with one particular post. It is not getting indexed, no matter what I try.

    Could you please give me any solution regarding the same.

    1. Hey Hazel,

      Either the permalink structure has been changed or the content is deindexed by Google. If you’re using the CSS or JS files, they only affect the design of your website. No correlation with indexing.

      For indexing, try to update that post or maybe redirect to a new one.

      ~Ravi

  2. Hi Ravi. Thanks for sharing this post on LinkedIn. I’ve seen that error before but I must have taken care of it because it is gone. Your post did serve as a good reminder to take another look at my robots.txt file to make sure it was up to date. Now I’ll keep an eye on my Search Console to see if I just created any problems.

    I did see one change after I updated my robots.txt file. The old version only blocked wp-admin. Google was able to render my homepage completely. I updated robots.txt like in your example to also block wp-includes plus the plugins and themes folders. When I asked Google to fetch and render this time it was only able to do it partially. It still gave it a green checkmark, so I’m guessing that it is still happy and it didn’t any any blocked errors right away.

    Any thoughts?

    1. Hey Wayne,

      As I have mentioned, you can easily check the effect of blocking these files on the design of your website. If everything looks good then you don’t need to remove these files.

      Sometimes a plugin adds such CSS and JavaScript files. And if we talk about the wp-admin area, it occurs when you use any plugin to protect it, change the default login page or something similar.

      If Google is fetching is perfectly then no worries.

      ~Ravi

Leave a Reply

Your email address will not be published. Required fields are marked *